<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"  xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">

<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">


<title></title>
<meta name="keywords" content="">
<meta name="description" content="">

<link rel="shortcut icon" href="favicon.ico">
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/font-awesome.css?v=4.4.0" rel="stylesheet">
<link href="/css/animate.css" rel="stylesheet">
<link href="/css/style.css?v=4.1.0" rel="stylesheet">
</head>
<body class="gray-bg">
	<div class="wrapper wrapper-content">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="signupForm">
							<input id="parentId" name="parentId" type="hidden" th:value="${dispatch.parentId}" />
							<input id="id" name="id" type="hidden" th:value="${dispatch.id}" />
							<input type="hidden" th:value="${flag}" id="flag" name="flag">
							<input type="hidden" th:value="${teamFlag}" id="teamFlag" name="teamFlag">
							<div class="form-group">
								<label class="col-sm-3 control-label">邮费类型：</label>
								<div class="col-sm-8">
									<label class="radio-inline">
										<input type="radio" name="calculatetype" value="0"
											   onchange ="Change()"/> 按重量
									</label>

									<label class="radio-inline">
										<input type="radio" name="calculatetype" value="1"
											   onchange ="Change()"/> 按件
									</label>
<!--									<label class="radio-inline"> <input type="radio" th:field="*{dispatch.calculatetype}" name="type" value="2" /> 包邮</label>-->
<!--									<label class="radio-inline"> <input type="radio" th:field="*{dispatch.calculatetype}" name="type" value="3" /> 通用</label>-->
<!--									<label class="radio-inline"> <input type="radio" th:field="*{dispatch.calculatetype}" name="type" value="4" /> 距离</label>-->
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">*选择商户：</label>
								<div class="col-sm-8">
									<select data-placeholder="商户" class="form-control chosen-select" name="centreId" tabindex="2"  id="centreId"
											onchange="getCentreTeamList(this)">
										<option value="0"  th:if="${flag} == '0'">选择商户</option>
										<option th:each="item: ${centreList}" th:text="${item.name}" th:value="${item.centreId}" th:selected="${dispatch.centreId eq item.centreId}"></option>
									</select>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">*选择门店：</label>
								<div class="col-sm-8">
									<select data-placeholder="门店" class="form-control chosen-select" name="teamId" tabindex="2"  id="teamId">
										<option value="0" th:if="${teamFlag} == '0'">选择门店</option>
										<option th:each="item: ${teamList}"  th:text="${item.tXiaoqu}" th:value="${item.teamid}" th:selected="${dispatch.teamId eq item.teamid}"></option>
									</select>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">模板名称：</label>
								<div class="col-sm-8">
									<input id="dispatchname" name="dispatchname" class="form-control" type="text"
										th:value="${dispatch.dispatchname}" required>
								</div>
							</div>

<!--							<div class="form-group">-->
<!--								<label class="col-sm-3 control-label">首重邮费：</label>-->
<!--								<div class="col-sm-8">-->
<!--										<input id="firstprice" name="firstprice" class="form-control" type="number" min="0"-->
<!--                                         th:value="${dispatch.firstprice}">-->
<!--								</div>-->
<!--							</div>-->
<!--							<div class="form-group">-->
<!--								<label class="col-sm-3 control-label">首重/包邮满减：</label>-->
<!--								<div class="col-sm-8">-->
<!--									<input id="firstweight" name="firstweight" class="form-control" type="number" min="0"-->
<!--									th:value="${dispatch.firstweight}">-->
<!--								</div>-->
<!--							</div>-->
<!--							<div class="form-group">-->
<!--								<label class="col-sm-3 control-label">续重：</label>-->
<!--								<div class="col-sm-8">-->
<!--									<input id="secondweight" name="secondweight" class="form-control" type="number" min="0"-->
<!--                                       th:value="${dispatch.secondweight}">-->
<!--								</div>-->
<!--							</div>-->

							<div id="height" style="display: none">
								<div class="form-group">
									<label class="col-sm-3 control-label">首重邮费：</label>
									<div class="col-sm-8">
										<input id="firstprice" name="firstprice" class="form-control" type="number" min="0"
											   th:value="${dispatch.firstprice}">
									</div>
								</div>

								<div class="form-group">
									<label class="col-sm-3 control-label">续重邮费：</label>
									<div class="col-sm-8">
										<input id="secondprice" name="secondprice" class="form-control" type="number" min="0"
											   th:value="${dispatch.secondprice}">
									</div>
								</div>

								<div class="form-group">
									<label class="col-sm-3 control-label">首重：</label>
									<div class="col-sm-8">
										<input id="firstweight" name="firstweight" class="form-control" type="number" min="0"
											   th:value="${dispatch.firstweight}">
									</div>
								</div>

								<div class="form-group">
									<label class="col-sm-3 control-label">续重：</label>
									<div class="col-sm-8">
										<input id="secondweight" name="secondweight" class="form-control" type="number" min="0"
											   th:value="${dispatch.secondweight}">
									</div>
								</div>
							</div>

							<div id="num" style="display: none">
								<div class="form-group">
									<label class="col-sm-3 control-label">首档邮费：</label>
									<div class="col-sm-8">
										<input id="firstnumprice" name="firstnumprice" class="form-control" type="number" min="0"
											   th:value="${dispatch.firstnumprice}">
									</div>
								</div>

								<div class="form-group">
									<label class="col-sm-3 control-label">续档邮费：</label>
									<div class="col-sm-8">
										<input id="secondnumprice" name="secondnumprice" class="form-control" type="number" min="0"
											   th:value="${dispatch.secondnumprice}">
									</div>
								</div>

								<div class="form-group">
									<label class="col-sm-3 control-label">首档数量：</label>
									<div class="col-sm-8">
										<input id="firstnum" name="firstnum" class="form-control" type="number" min="0"
											   th:value="${dispatch.firstnum}">
									</div>
								</div>

								<div class="form-group">
									<label class="col-sm-3 control-label">续档数量：</label>
									<div class="col-sm-8">
										<input id="secondnum" name="secondnum" class="form-control" type="number" min="0"
											   th:value="${dispatch.secondnum}">
									</div>
								</div>
							</div>

							<div class="form-group text-center">
								<div class="col-sm-8 col-sm-offset-2">
									<button type="submit" class="btn btn-primary"><i class="fa fa-check"></i>提交</button>
									<div class="btn btn-danger" onclick="closeDow()"><i class="fa fa-remove"></i> 关闭</div>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div th:include="include::footer"></div>
	<script src="/js/appjs/platform/edit.js"></script>
	<script type="text/javascript">
		function closeDow() {
			var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
			parent.layer.close(index);
		}

        function getCentreTeamList(obj) {
            var index = obj.options[obj.selectedIndex].value;
            var html = "";
            if (index == 0) {
                // $("#teamId").html(html);
            } else {
                $.ajax({
                    url: "/commander/manage/getTeamList?centreId=" + index,
                    dataType: "json",
                    success: function (data) {
                        for (var i = 0; i < data.length; i++) {
                            //<!--<option th:each="item: ${teamList}" th:text="${item.tXiaoqu}" th:value="${item.teamid}"></option>-->
                            html += '<option value="' + data[i].teamid + '">' + data[i].tXiaoqu + '</option>';
                        }
                        $("#teamId").html(html);
                    }
                })
            }
        }
	</script>
</body>

</html>
